Skip to content

Fix clone destination initialization - #4236

Closed
Zeus-Deus wants to merge 1 commit into
pingdotgg:mainfrom
Zeus-Deus:t3code/fix-clone-path
Closed

Fix clone destination initialization#4236
Zeus-Deus wants to merge 1 commit into
pingdotgg:mainfrom
Zeus-Deus:t3code/fix-clone-path

Conversation

@Zeus-Deus

@Zeus-Deus Zeus-Deus commented Jul 21, 2026

Copy link
Copy Markdown

Summary

  • infer the checkout directory from HTTPS, SSH, SCP-style, and local Git remotes
  • initialize web and mobile clone flows with the full destination path instead of the non-empty parent directory
  • add regression coverage for the reported GitHub SSH URL and cross-platform paths

Testing

  • vp test packages/shared/src/git.test.ts packages/client-runtime/src/operations/projects.test.ts
  • vp test apps/server/src/sourceControl/SourceControlRepositoryService.test.ts
  • vp check
  • vp run typecheck
  • vp run lint:mobile

Note

Low Risk
UX-only default path initialization with shared parsing logic and unit tests; no changes to clone or auth behavior.

Overview
Clone flows on web and mobile now prefill the destination path with the inferred repo folder (e.g. ~/projects/codex) instead of only the add-project base directory.

A new shared helper inferGitCloneDirectoryName parses HTTPS, SSH/SCP, Azure DevOps, local paths, and .git/.bundle suffixes; getCloneDestinationInitialQuery appends that name to the configured base path and falls back to the base alone when inference fails. Regression tests cover cross-platform paths and edge cases.

Reviewed by Cursor Bugbot for commit 32dbcbc. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix clone destination path to include inferred repository directory name from remote URL

  • Adds inferGitCloneDirectoryName in packages/shared/src/git.ts to extract a checkout directory name from URL-shaped, SCP-style, and local-path remotes, stripping .git/.bundle suffixes and decoding percent-encoding.
  • Adds getCloneDestinationInitialQuery in packages/client-runtime/src/operations/projects.ts that composes the base directory with the inferred directory name to produce a full destination path.
  • Updates the mobile AddProjectDestinationScreen and the web OpenCommandPaletteDialog clone flow to use getCloneDestinationInitialQuery, so the suggested destination now includes the inferred repo name and updates when remoteUrl changes.

Macroscope summarized 32dbcbc.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7c86dd57-6e38-46d8-a2aa-a5ac0fa0cedd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jul 21, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 32dbcbc. Configure here.

);
const encodedName = withoutDotGitDirectory
.slice(lastSeparatorIndex + 1)
.replace(/\.(?:git|bundle)$/i, "");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Colon breaks checkout name inference

Low Severity

inferGitCloneDirectoryName treats the last : in the string like a path separator when picking the final segment. SCP remotes only use the first colon after the host; extra colons in the repo path (without /) and local paths whose final component contains : can yield a shorter wrong default checkout name in getCloneDestinationInitialQuery.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 32dbcbc. Configure here.

@macroscopeapp

macroscopeapp Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This PR adds a utility function to infer repository names from git URLs and improves the default clone destination path suggestions. Changes are well-tested, additive, and only affect UI default values without impacting actual clone operations. The open review comment addresses a low-severity edge case.

You can customize Macroscope's approvability policy. Learn more.

@t3dotgg

t3dotgg commented Aug 23, 2026

Copy link
Copy Markdown
Member

Note

🤖 GPT-5.6 Sol responding on behalf of Theo

Closing this PR after an automated pass over open pull requests. Clone destination handling already shipped in #5989.

@t3dotgg t3dotgg closed this Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants